package com.dengdai.apputils.fragments;

import android.os.Handler;
import android.view.View;
import com.dengdai.applibrary.adapter.BaseCommAdapter;
import com.dengdai.applibrary.fragments.BaseListFragment;
import com.dengdai.apputils.adapters.TextListAdapter;
import com.dengdai.pullrefresh.library.PullToRefreshBase;
import java.util.ArrayList;
import java.util.List;

/**
 * @说明
 * @作者 LY
 * @时间 16/5/26 14:59
 * @邮箱 2743569843@qq.com
 * @版权 Copyright(c) 2016 LY-版权所有
 * @备注
 */
public class TextListFragment extends BaseListFragment<String> {

    public static TextListFragment newInstance() {
        return new TextListFragment();
    }

    @Override
    public PullToRefreshBase.Mode getListViewMode() {
        return PullToRefreshBase.Mode.BOTH;
    }

    @Override
    public void itemClick(Object o, int position) {

    }

    @Override
    public void loadingData() {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                List<String> list = new ArrayList<>();
                for (int i = 0; i < 30; i++) {
                    list.add("我是测试   " + page + "   " + +i);
                }
                baseCommAdapter.setList(list);
                page++;
                stopRefreshView();
            }
        }, 3000);
    }

    @Override
    public BaseCommAdapter getAdapter() {
        return new TextListAdapter(getActivity());
    }

    @Override
    public View getHeaderView() {
        return null;
    }

    @Override
    public View getFooterView() {
        return null;
    }
}
